package wowraidmanager.client.auction.data.canvas;

import com.google.gwt.canvas.client.Canvas;
import com.google.gwt.canvas.dom.client.Context2d.TextBaseline;

public class DrawExampleCanvas extends BaseDrawCanvas{

    static String ALLIANCE_EXAMPLE = "Alliance";
    static String HORDE_EXAMPLE = "Horde";
    static String NEUTRAL_EXAMPLE = "Neutral";

    static String AVERAGE_BUYOUT = "average buyout";
    static String MINIMUM_BUYOUT = "minimum buyout";

    public DrawExampleCanvas(Canvas dataCanvas){
        super(dataCanvas);
        setExample();
    }

    private void setExample(){
        dataContext.setFillStyle(backGroundColor);
        dataContext.beginPath();
        dataContext.fillRect(0, 0, 400, 100);
        dataContext.fill();

        dataContext.setFillStyle(textColor);
        dataContext.setFont("8px 'Helvetica'");
        dataContext.setTextBaseline(TextBaseline.MIDDLE);
        dataContext.fillText(ALLIANCE_EXAMPLE, 100, 10);
        dataContext.fillText(AVERAGE_BUYOUT, 10, 25);
        dataContext.fillText(MINIMUM_BUYOUT, 10, 40);
        dataContext.fillText(HORDE_EXAMPLE, 200, 10);
        dataContext.fillText(NEUTRAL_EXAMPLE, 300, 10);
        dataContext.closePath();

        dataContext.setLineWidth(3);
        dataContext.beginPath();
        dataContext.setStrokeStyle(allianceAverageColor);
        dataContext.arc(110, 25, 2, 0, Math.PI * 2);
        dataContext.moveTo(110, 25);
        dataContext.lineTo(170, 25);
        dataContext.arc(170, 25, 2, 0, Math.PI * 2);
        dataContext.stroke();
        dataContext.closePath();

        dataContext.beginPath();
        dataContext.setStrokeStyle(allianceMinimumColor);
        dataContext.arc(110, 40, 2, 0, Math.PI * 2);
        dataContext.moveTo(110, 40);
        dataContext.lineTo(170, 40);
        dataContext.arc(170, 40, 2, 0, Math.PI * 2);
        dataContext.stroke();
        dataContext.closePath();

        dataContext.beginPath();
        dataContext.setStrokeStyle(hordeAverageColor);
        dataContext.arc(210, 25, 2, 0, Math.PI * 2);
        dataContext.moveTo(210, 25);
        dataContext.lineTo(270, 25);
        dataContext.arc(270, 25, 2, 0, Math.PI * 2);
        dataContext.stroke();
        dataContext.closePath();

        dataContext.beginPath();
        dataContext.setStrokeStyle(hordeMinimumColor);
        dataContext.arc(210, 40, 2, 0, Math.PI * 2);
        dataContext.moveTo(210, 40);
        dataContext.lineTo(270, 40);
        dataContext.arc(270, 40, 2, 0, Math.PI * 2);
        dataContext.stroke();
        dataContext.closePath();

        dataContext.beginPath();
        dataContext.setStrokeStyle(neutralAverageColor);
        dataContext.arc(310, 25, 2, 0, Math.PI * 2);
        dataContext.moveTo(310, 25);
        dataContext.lineTo(370, 25);
        dataContext.arc(370, 25, 2, 0, Math.PI * 2);
        dataContext.stroke();
        dataContext.closePath();

        dataContext.beginPath();
        dataContext.setStrokeStyle(neutralMinimumColor);
        dataContext.arc(310, 40, 2, 0, Math.PI * 2);
        dataContext.moveTo(310, 40);
        dataContext.lineTo(370, 40);
        dataContext.arc(370, 40, 2, 0, Math.PI * 2);
        dataContext.stroke();
        dataContext.closePath();
    }
}
